// const list = [
//     {name:'宁波银行',id:1,amount:100},{name:'鄞州银行',id:1,amount:188},{name:'宁波银行',id:1,amount:88},
//     {name:'浙江银行',id:1,amount:7700},{name:'宁波银行',id:1,amount:200},{name:'浙商银行',id:1,amount:268},
//     {name:'西湖银行',id:1,amount:231},{name:'南湖银行',id:1,amount:62},{name:'浙商银行',id:1,amount:268},
//     {name:'浙江银行',id:1,amount:14},{name:'西湖银行',id:1,amount:2626200},{name:'百度银行',id:1,amount:626},
//     {name:'宁波银行',id:1,amount:100},{name:'鄞州银行',id:1,amount:5436},{name:'宁波银行',id:1,amount:88},
//     {name:'浙江银行',id:1,amount:774010},{name:'宁波银行',id:1,amount:5435},{name:'浙商银行',id:1,amount:268},
//     {name:'西湖银行',id:1,amount:41},{name:'南湖银行',id:1,amount:200},{name:'浙商银行',id:1,amount:26},
//     {name:'浙江银行2',id:1,amount:4124},{name:'西湖银行',id:1,amount:200},{name:'百度银行',id:1,amount:268},
//     {name:'宁波银行',id:1,amount:4124},{name:'鄞州银行',id:1,amount:188},{name:'宁波银行',id:1,amount:2656},
//     {name:'浙江银行',id:1,amount:4124},{name:'宁波银行',id:1,amount:626},{name:'浙商银行',id:1,amount:268},
//     {name:'西湖银行',id:1,amount:412},{name:'南湖银行',id:1,amount:200},{name:'浙商银行1',id:1,amount:268},
//     {name:'浙江银行',id:1,amount:43432},{name:'西湖银行',id:1,amount:200},{name:'百度银行',id:1,amount:268},
// ]

function groupByKey(list,key){
    //双指针排序
    //固定左指针，右滑右指针
    //如果右指针的值==左指针的值，右指针与左指针+1互换，左指针右移一位，右指针继续右移
    //直到右指针到最右边，然后右移左指针
    //继续下一次循环，直到左指针溢出
    let left =0
    const len = list.length
    while(left<list.length){
        for(let j=left+1;j<len;j++){
            if( list[j][key] == list[left][key] ){
                const node = list[j]
                list[j] = list[left+1]
                list[left+1] = node
                left ++ 
            }
        }
        left++
    }
}

function sortByKey(list, key){
    for(let i =0;i<list.length; i++){

    }
}

export default{
    groupByKey,  //按照key分组
    sortByKey,   //按照key排序
}
